import java.util.Scanner;

public class Test3 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int width=sc.nextInt();
        int height=sc.nextInt();
        StringBuffer stringBuffer=new StringBuffer();
        for (int i = 0; i < height; i++) {

            for (int j = 0; j <width ; j++) {
                 stringBuffer.append('%');
            }
        }
        System.out.println(stringBuffer.length());
        int count=0;
        for (int i = 0; i < stringBuffer.length(); i++) {

            if(count!=0&&count%width==0){
                System.out.println();
                count=0;

            }
                count++;
                System.out.print(stringBuffer.charAt(i));
        }
    }
}
